home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / spatch / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-05  |  4.2 KB  |  106 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Visual Basic v3.0 Stack Patch"
  6.    ClientHeight    =   4170
  7.    ClientLeft      =   1245
  8.    ClientTop       =   1605
  9.    ClientWidth     =   7485
  10.    Height          =   4575
  11.    Icon            =   FORM1.FRX:0000
  12.    Left            =   1185
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   4170
  15.    ScaleWidth      =   7485
  16.    Top             =   1260
  17.    Width           =   7605
  18.    Begin TextBox Text1 
  19.       Height          =   285
  20.       Left            =   2130
  21.       TabIndex        =   3
  22.       Text            =   "C:\VB\VB.EXE"
  23.       Top             =   3120
  24.       Width           =   3345
  25.    End
  26.    Begin CommandButton Command1 
  27.       Caption         =   "&Patch"
  28.       Height          =   525
  29.       Left            =   2790
  30.       TabIndex        =   0
  31.       Top             =   3540
  32.       Width           =   2145
  33.    End
  34.    Begin Label Label3 
  35.       Alignment       =   2  'Center
  36.       BackColor       =   &H00C0C0C0&
  37.       Caption         =   "Path to the VB.EXE (will be copied to VB.001 before patch is applied)"
  38.       Height          =   255
  39.       Left            =   -30
  40.       TabIndex        =   4
  41.       Top             =   2850
  42.       Width           =   7515
  43.    End
  44.    Begin Label Label2 
  45.       Alignment       =   2  'Center
  46.       BackColor       =   &H00808080&
  47.       BorderStyle     =   1  'Fixed Single
  48.       Caption         =   "The code used in this application was copied from a message by Art Rothstein, 70353,47. This information is provided so that proper credit may be assigned. It does not mean, however that Art has any responsibility for the success or failure of the patch. In other words, ""Use at your own risk!"" The program was written by Chris Monro, 74250,1327"
  49.       ForeColor       =   &H00FFFF00&
  50.       Height          =   1035
  51.       Left            =   240
  52.       TabIndex        =   2
  53.       Top             =   1770
  54.       Width           =   7065
  55.    End
  56.    Begin Label Label1 
  57.       Alignment       =   2  'Center
  58.       BackColor       =   &H00C0C0C0&
  59.       Caption         =   "This program patches a backup copy of the VB for Windows version 3.0 executable to increase the available stack size for compiled applications from 20K to 40K. Enter the full path of the EXE and Stack Patch will copy the file to VB.001 and make the patch against it. You should close VB and copy the ""old"" VB.EXE to a safe place or rename the file, to keep as a backup copy. Next, rename or copy the VB.001 to VB.EXE. MAKE certain that you save a copy of the pre-patched version of VB.EXE just in case. Stack Patch will notify you of the success or failure of the patch."
  60.       Height          =   1665
  61.       Left            =   600
  62.       TabIndex        =   1
  63.       Top             =   150
  64.       Width           =   6525
  65.    End
  66. Sub Command1_Click ()
  67.  On Error GoTo FileError
  68.  If Right$(Text1.Text, 6) <> "VB.EXE" Then MsgBox "You didn't provide the proper path and name of the VB.EXE. Try again.": Exit Sub
  69.  Screen.MousePointer = 11
  70.  Length = Len(Text1.Text) - 3
  71.  VBPath = Text1.Text
  72.  Text1.Text = "Making backup of VB.EXE"
  73.  Text1.Refresh
  74.  DestFile = Left$(VBPath, Length) & "001"
  75.  FileCopy VBPath, DestFile
  76.  Text1.Text = "Patching VB.001"
  77.  Text1.Refresh
  78.  Open DestFile For Binary Access Read Write As #1
  79.    Get #1, 1555, StackVB%
  80.    Get #1, 82743, StackCompiled%
  81.    Get #1, 101254, Checksum%
  82.    If StackVB% <> &H5000 Then GoTo ValidationError
  83.    If StackCompiled% <> &H5000 Then GoTo ValidationError
  84.    If Checksum% <> &HBC57 Then GoTo ValidationError
  85.    StackVB% = &HA000
  86.    StackCompiled% = &HA000
  87.    Checksum% = &H1282
  88.    Put #1, 1555, StackVB%
  89.    Put #1, 82743, StackCompiled%
  90.    Put #1, 101254, Checksum%
  91.    MsgBox "Patch successful"
  92.    Screen.MousePointer = 0
  93.    Text1.Text = VBPath
  94.    Exit Sub
  95. ValidationError:
  96.    MsgBox "Validation failure"
  97.    Screen.MousePointer = 0
  98.    Text1.Text = VBPath
  99.    Exit Sub
  100. FileError:
  101.     Select Case Err
  102.         Case Else: MsgBox "An error occurred while running Stack Patch. The error number is: " & Err: Screen.MousePointer = 0: Text1.Text = "ERROR": Exit Sub
  103.         Resume
  104.     End Select
  105. End Sub
  106.